<form action="index.php/user/update_edit/" method="post" name="myform"  onSubmit="return check()">
<div id="inline2">
<h2><span>用户信息</span></h2>
<table>
        <tr><th colspan="5" style="height:16px; line-height:16px;">&nbsp;</th></tr>
        <tr>
        	<td class="name"><span>*</span>帐号：</td>
            <td><input class="text_width" type="text" name="account" value=<?=$update_user->account?> ></input></td>
        </tr>
        <tr>
            <td class="name"><span>*</span>密码：</td>
            <?php $password = substr($update_user->password, 0, 8);?>
            <td><input type="password" name="password"  value=<?= $password?> ></input></td>
        </tr>
        <tr>
        	<td class="name"><span>*</span>姓名：</td>
            <td><input type="text" name="user_name" value=<?=$update_user->user_name?> ></input></td>
        </tr>
        <tr>
            <td class="name"><span>*</span>角色：</td>
            <td>
                <select name="role" style=" width:198px; margin-left:3px;">
                	<option value="市场">市场</option>
                	<option value="经理">经理</option>
                    <option value="商务助理">商务助理</option>
                </select>
            </td>
        </tr>
        <tr>
        	<td class="name"><span>*</span>邮箱：</td>
            <td><input type="text" name="email" value=<?=$update_user->email?>></input></td>
        </tr>
        <tr><td colspan="5">&nbsp;</td></tr>
        <tr class="sub">
            <td colspan="5"><input type="submit" value="提交" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="重置" /></td> 
        </tr>
    </table>
</div>
<input type="hidden" name="id" value=<?=$update_user->id?> >
</form>
<script type="text/javascript">
	function check(){
		var error="";
		var account=document.getElementsByName("account")[0].value;
		var password=document.getElementsByName("password")[0].value;
		var user_name=document.getElementsByName("user_name")[0].value;
		var email=document.getElementsByName("email")[0].value;
		if(user_name == ""){
			 error="错误：\x0d";
             error+="用户名称不允许为空,请填写\x0d";
	    }
	    if(password == "" ){
		     if(error==""){
		    	 error="错误：\x0d";
			 }
	    	 error+="密码不允许为空,请填写\x0d";
		}else{
			if(password.length<6){
				if(error==""){
			    	 error="错误：\x0d";
				 }
				error+="密码长度必须大于6位,请重新填写\x0d";
			  }
			}
		if(account == ""){
			if(error==""){
		    	 error="错误：\x0d";
			 }
			 error+="账户不允许为空,请填写\x0d";
		}
		if(email == ""){
			if(error==""){
		    	 error="错误：\x0d";
			 }
			 error+="邮箱不允许为空,请填写\x0d";
		}else{
				if(!email.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)){
					error+="格式不正确！请重新输入";
				}
		}
        if(error != ""){
        	alert(error);
    		return false;
        }else{
            return true;
        }
	}
</script>